// 变量类型
export const BE_TYPE = {
  String: 'String',
  Integer: 'Integer',
  Number: 'Number',
  Boolean: 'Boolean',
  Time: 'Time',
  Object: 'Object',
  Array: {
    String: 'String',
    Integer: 'Integer',
    Number: 'Number',
    Boolean: 'Boolean',
    Time: 'Time',
    Object: 'Object'
  },
  File: {
    Default: 'Default',
    Image: 'Image',
    Svg: 'Svg',
    Audio: 'Audio',
    Video: 'Video',
    Voice: 'Voice',
    Doc: 'Doc',
    PPT: 'PPT',
    Excel: 'Excel',
    Txt: 'Txt',
    Code: 'Code',
    Zip: 'Zip'
  }
}
export const BE_TYPE_LIST = [
  {
    label: 'String',
    value: 'String'
  },
  {
    label: 'Integer',
    value: 'Integer'
  },
  {
    label: 'Number',
    value: 'Number'
  },
  {
    label: 'Boolean',
    value: 'Boolean'
  },
  {
    label: 'Object',
    value: 'Object'
  },
  {
    label: 'Array<String>',
    value: 'Array<String>'
  },
  {
    label: 'Array<Integer>',
    value: 'Array<Integer>'
  },
  {
    label: 'Array<Number>',
    value: 'Array<Number>'
  },
  {
    label: 'Array<Boolean>',
    value: 'Array<Boolean>'
  },
  {
    label: 'Array<Object>',
    value: 'Array<Object>'
  }
]
// ,{
//   label: 'File',
//   value: 'File',
//   children: [
//     {
//       label: 'Default',
//       value: 'Default',
//     },{
//       label: 'Image',
//       value: 'Image',
//     },{
//       label: 'Svg',
//       value: 'Svg',
//     },{
//       label: 'Audio',
//       value: 'Audio',
//     },{
//       label: 'Video',
//       value: 'Video',
//     },{
//       label: 'Voice',
//       value: 'Voice',
//     },{
//       label: 'Doc',
//       value: 'Doc',
//     },{
//       label: 'PPT',
//       value: 'PPT',
//     },{
//       label: 'Excel',
//       value: 'Excel',
//     },{
//       label: 'Txt',
//       value: 'Txt',
//     },{
//       label: 'Code',
//       value: 'Code',
//     },{
//       label: 'Zip',
//       value: 'Zip',
//     }
//   ]
// },

export const VARTYPE_VALUES = {
  String: '',
  Integer: 0,
  Number: 0,
  Boolean: false,
  Object: {},
  'Array<String>': [],
  'Array<Integer>': [],
  'Array<Number>': [],
  'Array<Boolean>': [],
  'Array<Object>': []
}

// 结束节点的面板tab类型
export const DEFAULT_END_TAB = [
  {
    label: '返回变量',
    value: 'var'
  },
  {
    label: '返回文本',
    value: 'text'
  }
]
export const DEFAULT_END_TAB_VALUE = {
  var: '返回变量',
  text: '返回文本'
}

// 符号集合
export const LOGIC_VALUES = {
  or: '且',
  and: '或'
}
export const LOGIC_OPTIONS = [
  {
    value: 'or',
    name: '且'
  },
  {
    value: 'and',
    name: '或'
  }
]
export const OPERATOR_OPTIONS = {
  String: [
    {
      type: 0,
      mark: '=',
      name: '等于'
    },
    {
      type: 1,
      mark: '≠',
      name: '不等于'
    },
    {
      type: 2,
      mark: '>',
      name: '长度大于'
    },
    {
      type: 3,
      mark: '≥',
      name: '长度大于等于'
    },
    {
      type: 4,
      mark: '<',
      name: '长度小于'
    },
    {
      type: 5,
      mark: '≤',
      name: '长度小于等于'
    },
    {
      type: 6,
      mark: '⊂',
      name: '包含'
    },
    {
      type: 7,
      mark: '⊄',
      name: '不包含'
    }
  ],
  Number: [
    {
      type: 0,
      mark: '=',
      name: '等于'
    },
    {
      type: 1,
      mark: '≠',
      name: '不等于'
    },
    {
      type: 2,
      mark: '=',
      name: '为空',
      equal: 'Empty'
    },
    {
      type: 3,
      mark: '≠',
      name: '不为空',
      equal: 'Empty'
    },
    {
      type: 4,
      mark: '>',
      name: '大于'
    },
    {
      type: 5,
      mark: '≥',
      name: '大于等于'
    },
    {
      type: 6,
      mark: '<',
      name: '小于'
    },
    {
      type: 7,
      mark: '≤',
      name: '小于等于'
    }
  ],
  Integer: [
    {
      type: 0,
      mark: '=',
      name: '等于'
    },
    {
      type: 1,
      mark: '≠',
      name: '不等于'
    },
    {
      type: 2,
      mark: '=',
      name: '为空',
      equal: 'Empty'
    },
    {
      type: 3,
      mark: '≠',
      name: '不为空',
      equal: 'Empty'
    },
    {
      type: 4,
      mark: '>',
      name: '大于'
    },
    {
      type: 5,
      mark: '≥',
      name: '大于等于'
    },
    {
      type: 6,
      mark: '<',
      name: '小于'
    },
    {
      type: 7,
      mark: '≤',
      name: '小于等于'
    }
  ],
  Time: [
    {
      type: 0,
      mark: '=',
      name: '等于'
    },
    {
      type: 1,
      mark: '≠',
      name: '不等于'
    },
    {
      type: 2,
      mark: '=',
      name: '为空',
      equal: 'Empty'
    },
    {
      type: 3,
      mark: '≠',
      name: '不为空',
      equal: 'Empty'
    },
    {
      type: 4,
      mark: '>',
      name: '大于'
    },
    {
      type: 5,
      mark: '≥',
      name: '大于等于'
    },
    {
      type: 6,
      mark: '<',
      name: '小于'
    },
    {
      type: 7,
      mark: '≤',
      name: '小于等于'
    }
  ],
  Boolean: [
    {
      type: 0,
      mark: '=',
      name: '等于'
    },
    {
      type: 1,
      mark: '≠',
      name: '不等于'
    },
    {
      type: 2,
      mark: '=',
      name: '为空',
      equal: 'Empty'
    },
    {
      type: 3,
      mark: '≠',
      name: '不为空',
      equal: 'Empty'
    },
    {
      type: 4,
      mark: '=',
      name: '为true',
      equal: 'true'
    },
    {
      type: 5,
      mark: '=',
      name: '为false',
      equal: 'false'
    }
  ],
  Object: [
    {
      type: 0,
      mark: '⊂',
      name: '包含键名'
    },
    {
      type: 1,
      mark: '⊄',
      name: '不包含键名'
    },
    {
      type: 2,
      mark: '=',
      name: '为空',
      equal: 'Empty'
    },
    {
      type: 3,
      mark: '≠',
      name: '不为空',
      equal: 'Empty'
    }
  ]
}
function transOperator() {
  const temp = {}
  Object.keys(OPERATOR_OPTIONS).forEach((key) => {
    const item = {}
    OPERATOR_OPTIONS[key].forEach((operator) => {
      item[operator.mark] = operator
    })
    temp[key] = item
  })
  return temp
}

export const OPERATOR_VALUES = transOperator()

// 异常处理-重试次数选择项
export const RETRY_OPTIONS = [
  {
    label: '不重试',
    value: 0
  },
  {
    label: '重试1次',
    value: 1
  }
]
// 异常处理-异常处理方式选择项
export const HANDLE_OPTIONS = [
  {
    label: '中断流程',
    value: 0
  },
  {
    label: '返回设定内容',
    value: 1
  },
  {
    label: '执行异常流程',
    value: 2
  }
]

export const DOCSTRATEGY_OPTIONS = [
  { label: '快速解析', value: 'quick', desc: '不会对文档提取图像、表格等元素，适用于纯文本' },
  {
    label: '精准解析',
    value: 'precise',
    desc: '将从文档中提取图片、表格等元素，需要耗费更长的时间'
  }
]

export const SEGMENTATION_OPTONS = [
  { label: '自动分段', value: 'automatic', desc: '按照所选的标识符切分文本' },
  { label: '自定义分段', value: 'customiz', desc: '自定义分段规则、分段长度及预处理规则' }
]

export const SYMBOL_TYPE_OPTIONS = [
  { label: '换行', value: 'Linebreak' },
  { label: '2个换行', value: 'Twolinebreaks' },
  { label: '中文句号', value: 'Chinesefullstop' },
  { label: '中文叹号', value: 'Chineseexclamationmark' },
  { label: '英文句号', value: 'Englishperiod' },
  { label: '英文叹号', value: 'Englishexclamationmark' },
  { label: '中文问号', value: 'Chinesequestionmark' },
  { label: '英文问号', value: 'Englishquestionmark' },
  { label: '自定义', value: 'LinebreakCustomize' }
]

export const PRECISE_OPTIONS = [
  { label: '图片元素', value: 'image' },
  { label: '扫描件 (OCR)', value: 'OCR' },
  { label: '表格元素', value: 'table' }
]

export const BODY_TYPE_OPTIONS = [
  { label: 'x-www-form-urlencoded', value: 'x-www-form-urlencoded' },
  { label: 'raw text', value: 'raw text' },
  { label: 'form-data', value: 'form-data' },
  { label: 'JSON', value: 'JSON' },
  { label: 'none', value: 'none' },
  { label: 'binary', value: 'binary' }
]

export const SOURCE_OPTIONS = [
  { label: '系统变量', value: 'sysvar' },
  { label: '应用变量', value: 'appvar' },
  { label: '用户变量', value: 'uservar' }
]
